<?php
// +----------------------------------------------------------------------
// | 景区信息导出       D:20150820
// +----------------------------------------------------------------------
include('/var/www/html/new/com.inc.php');
include('/var/www/html/new/d/class/Member.php');
include('/var/www/html/new/d/class/abc/Product.class.php');
include('/var/www/html/new/d/class/abc/PFTCore777.class.php');
include('/var/www/html/new/d/class/SimpleExcel.class.php');
include('/var/www/html/new/d/common/area.inc.php');

$ac = $GLOBALS['_ac'];
$pw = $GLOBALS['_pw'];
$s  = new SoapClient(null,array("location" => "http://localhost/open/openService/pft_insideMX.php","uri" => "www.16u.com?ac_16u=$ac|pw_16u=$pw|auth_16u=true"));

if(!isset($_SESSION['sid'])) exit('登陆超时');

$memberSID  = $_SESSION['sid'];
$m          = new Member($s, $memberSID);
$salePros_m = $m->salePros(); // 2000 个产品大概 0.6 - 0.8 s

$filename = date('YmdHis').'分销商产品列表';
$Excel[0]['a'] = '省';
$Excel[0]['b'] = '市';
$Excel[0]['c'] = '景区SID';
$Excel[0]['d'] = '景区6位数ID';
$Excel[0]['e'] = '景区名称';
$Excel[0]['f'] = '供应商';
$Excel[0]['g'] = '状态';
$Excel[0]['h'] = '景区级别';
$Excel[0]['i'] = '景区主题';
$Excel[0]['j'] = '创建时间';
$Excel[0]['k'] = '供货价';
$Excel[0]['l'] = '门市价';
$Excel[0]['m'] = '建议零售价';
$Excel[0]['n'] = '取票信息';
$i = 1;
foreach($salePros_m as $row){
	if($row['sapply_did']==$_SESSION['sid']) continue;
	list($prov, $city) = explode('|', $row['area']);
	$Excel[$i]['a'] = $areas[$prov];
	$Excel[$i]['b'] = $areas[$city];
	$Excel[$i]['c'] = $row['lid'];
	$Excel[$i]['d'] = $row['salerid'];
	$Excel[$i]['e'] = $row['title'].$row['ttitle'];
	$Excel[$i]['f'] = $suppliers[$row['sapply_did']];
	$Excel[$i]['g'] = '在售';
	$Excel[$i]['h'] = $row['jtype'];
	$Excel[$i]['i'] = $row['topic'];
	$Excel[$i]['j'] = $row['verify_time'];
	$Excel[$i]['k'] = $row['fprice'];
	$Excel[$i]['l'] = $row['uprice'];
	$Excel[$i]['m'] = $row['tprice'];
	$Excel[$i]['n'] = $row['getaddr'];
	$i++;
}

$xls = new SimpleExcel('UTF-8', true,'land');
$xls->addArray($Excel);
$xls->generateXML($filename);
exit;

